home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7921 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.8 KB

  1. Path: asmobj.larc.nasa.gov!jaapjl
  2. From: jaapjl@asmobj.larc.nasa.gov (Lee Jaap)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What the heck is ...?
  5. Date: 29 Feb 1996 18:14:36 GMT
  6. Organization: probably not speaking for AS&M Inc
  7. Message-ID: <JAAPJL.96Feb29131437@asmobj.larc.nasa.gov>
  8. References: <sconi-1102961642580001@ip-24.newportnet.net> <4fmlro$nfg_001@pr.mcs.net>
  9.     <4fnd5c$9a2@solutions.solon.com> <4fogla$ijo_002@news.mcs.net>
  10. Reply-To: J Lee Jaap <jaapjl@asmsun.larc.nasa.gov>
  11. NNTP-Posting-Host: asmobj.larc.nasa.gov
  12. In-reply-to: mdp@mika-sys.com's message of Mon, 12 Feb 96 22:57:46 GMT
  13.  
  14. In article <4fogla$ijo_002@news.mcs.net> mdp@mika-sys.com (Michael D. Perry) writes:
  15. |>Thank you for your comments.
  16. |>4.    I would point out however that your response which so 
  17. |>authoritatively negates my answer was lacking the correct answer 
  18. |>in its place.  Are you too far above the rest of us peons to 
  19. |>answer such a lowly question as this?  This is a shame as I, as 
  20. |>well as others, might have learned something from your thorough 
  21. |>and complete wisdom and knowledge on this subject had you 
  22. |>corrected my 'hapless blunder.'
  23.  
  24. I know I'm way behind with clc, and this may have been answered,
  25. so I'll post a short answer.
  26.  
  27. Your points are well taken.  This groups is for information,
  28. not flames.  Mild flames may be acceptable (IMO), but only if
  29. accompanied by a correct answer.
  30.  
  31. A decent ISO (ANSI) C book, and some traditional C books, will have a
  32. section on stdarg and varargs header files, which will explain
  33. variable argument lists.  The FAQ may even mention them.  Check the
  34. index or TOC.
  35.  
  36. The idea is that the scanf and printf families of functions can take
  37. any number of arguments (after the format string) of varying types, so
  38. there has to be a way to pass and use a varying number of arguments.
  39. The compiler checks the type of only the fixed arguments (and makes
  40. sure they occur in a function reference), but performs the standard
  41. conversions (float to double, short or char to int) for the varying
  42. args, depending upon the function innards to be able to figure out
  43. how many arguments there are and what types they are.
  44.  
  45. CAVEAT: When you use the stdarg facility (as with casts and some other
  46. elements of the language), you're telling the compiler not to do
  47. certain checks that modern compilers usually do, that you know that
  48. you're bending some of the usual rules, and that you take full
  49. responsibility for making sure you do everything right.  It's like
  50. removing some of the guards on a piece of machinery for maintenance:
  51. it's your responsibility to not wear loose or dangly clothing that
  52. might get caught.
  53.  
  54. Hmmm.  Did I say a "short" answer?  I think I've written what's
  55. necessary.
  56. --
  57. J Lee Jaap <JaapJL@ASMSun.LaRC.NASA.Gov> +1 804/865-7093
  58.       employed by, not necessarily speaking for,
  59.             AS&M Inc, Hampton VA 23666-1340
  60.